<template>
  <view>
    <view v-for="(item,index) in dataList">
      <uni-card :title="item.name" sub-title="" :extra="'价格:' + item.price" :thumbnail="avatar" @click="details(item.id)" :key="index">
        <text class="uni-body">{{item.introduction}}</text>
      </uni-card>
    </view>
  </view>
</template>


<script>
	export default {
		data() {
			return {
				avatar: require('@/static/pdficon.jpeg'),
        dataList: []
			}
		},
		methods: {
      details(id){
        uni.navigateTo({
          url: '/pages/index/details?id='+id
        })
      }
		},
    onInit() {
      console.log(233)
    },
    onLoad() {},
    //TODO 现在不清楚为啥这个写在onLoad里面不会调用
    mounted() {
      let that = this;
      this.$axios.get('/order/search',{
        headers: {
          token: localStorage.getItem('token')
        }
      }).then( res=> {
        //TODO 这里接口格式写错了，多了个data，以后可能会改吧
        that.dataList = res.data.data.data; //多了一个data
      })
    },
	}
</script>


<style>
	.container {
		padding: 0px;
		font-size: 14px;
		line-height: 24px;
	}
</style>
